package com.lemon.cloud.websocket.holder;

import org.springframework.web.socket.WebSocketSession;

/**
 * @author HuangDS
 */
public class SecuritySessionKeyGenerator implements SessionKeyGenerator {

    @Override
    public Object sessionKey(WebSocketSession webSocketSession) {
        Object key = webSocketSession.getAttributes().getOrDefault(USER_KEY_ATTR_NAME, null);
        return key!=null ? String.valueOf(key) : null;
    }

}
